import { Dayjs } from 'dayjs';

export interface Carrier {
  mid: string;
  companyName: string;
}

export interface ConsigneeWarehouse {
  id: string;
  houseName: string;
}

export interface GroupCode {
  itemKey: string;
  itemValue: string;
}

export interface ConsigneeWarehouseInfo {
  shippingType: number;
  consigneeWarehouseId: string;
  consigneeWarehouse: string;
  warehouseRemark: string;
  isUrgant: number;
  isDelivery: number;
  isPrintDelivery: number;
}

export interface SendDirectlyInfo {
  batchId: string; // 批次ID
}

export interface SelfPickupInfo {
  driverName: string;
  driverPhone: string;
  vehicleNo: string;
  driverIdCard: string;

  consigneeWarehouseId: string; // 仓库id
  warehouseRemark: string; // 出库要求
  isUrgant: number; // 是否加急，这里使用number类型代替0和1
  isDelivery: number; // 是否生成送货单
  isPrintDelivery: number; // 是否打印送货单
  batchId: string; // 批次ID
}

export interface ShippingInfo {
  carrierMid: string; // 承运商id
  deliveryTime: Dayjs | undefined; // 计划送达时间，这里假设它可以是字符串或Date对象
  deliveryRemark: string; // 运输要求
  carrierType: string; // 运输方式
  freightTypeId: string; // 计费方式

  consigneeWarehouseId: string; // 仓库id
  warehouseRemark: string; // 出库要求
  isUrgant: number; // 是否加急，这里使用number类型代替0和1
  isDelivery: number; // 是否生成送货单
  isPrintDelivery: number; // 是否打印送货单
  batchId: string; // 批次ID
}

interface AreaDetailItem {
  receiverProvince: string;
  receiverCity: string;
  receiverArea: string;
  receiverAddress: string;
  receiverAddressDisplay: string;
  consigneeProvince: string;
  consigneeCity: string;
  consigneeArea: string;
  consigneeAddress: string;
  consigneeAddressDisplay: string;
  distance: string;
  receiverRemark: string;
  deliveryCode: string;
  shippingCode: string;
  vehicleNo?: string | null;
  ownerName?: string;
  goodsWeight?: string;
  createTime?: string;
}

export type AreaDetailList = AreaDetailItem[];

interface DeliveryOrderDetail {
  goodsName: string;
  goodsNumber: string | number; // 假设 goodsNumber 可能是字符串或数字
  goodsUnit?: string | null; // 处理可能为 null 的情况
  goodsWeight: number;
  goodsBatch: string;
  goodsPack: string;
  stockCode?: string | null; // 处理可能为 null 的情况
}

export interface ShippingOrder {
  shippingType: number;
  distance: string;
  consigneeCompany: string;
  orderSn?: string | null; // 使用了可选链和联合类型来处理可能为 null 的情况
  consigneeWarehouseId: number;
  cancelType: number;
  receiverCompany: string;
  receiverProvince: string;
  serialCode?: string | null; // 同样处理可能为 null 的情况
  receiverCity: string;
  consigneeWarehouse: string;
  goodsWeight: number;
  consigneeName: string;
  receiverPhone: string;
  shippingId?: string | null;
  receiverRemark: string;
  consigneeArea: string;
  consigneePhone: string;
  deliveryCode: string;
  consigneeAddress: string;
  salesmanName?: string | null;
  consigneeProvince: string;
  showCustomer?: any; // 如果不确定类型，可以使用 any
  receiverName: string;
  deliveryType: number;
  salesmanArea?: string | null;
  receiverArea: string;
  receiverAddress: string;
  consigneeMid: string;
  deliveryOrderDetails: DeliveryOrderDetail[];
  consigneeCity: string;
}

export interface QueryDeatail {
  shippingOrderId?: number; // 非必须
  shippingType: number; // 必须
  shippingCompany?: string; // 非必须
  driverName?: string; // 非必须
  driverPhone?: string; // 非必须
  driverIdCard?: string; // 非必须
  deliveryRemark?: string; // 非必须
  vehicleNo?: string; // 非必须
  deliveryTime?: string; // 非必须，计划送达时间
  consigneeDate?: string; // 非必须，提货日期
  consigneeExpire?: string; // 非必须，提货有效期
  consigneeWarehouseId?: string; // 非必须，出库仓id
  consigneeWarehouse?: string; // 非必须，出库仓名称
  warehouseRemark?: string; // 非必须，出库要求
  carrierMid?: string; // 非必须，承运商id
  carrierName?: string; // 非必须，承运商名称
  isDelivery: number; // 必须，是否生成送货单
  isPrintDelivery: number; // 必须，是否可打印送货单
  isUrgant: number; // 必须，是否加急
  type: number; // 必须，派单方式
  deliveryOrderIds?: string[]; // 非必须，交货计划id集合
  carrierType?: string; // 非必须，运输方式
  freightType?: string; // 非必须，计费方式
  freightTypeId?: string; // 非必须，计费方式id
  expressNo?: string; // 非必须，快递单号
  batchId: string; // 必须，附件关联id
  sysOperationLog?: string; // 非必须，操作日志类型
  sysOperationRemark?: string; // 非必须，操作日志描述
  fileLabel?: string; // 非必须，附件label
}
